package cn.exrick.xboot.supervisionDepartment.controllerImpl

import cn.exrick.xboot.base.entity.Area
import cn.exrick.xboot.base.service.IAreaService
import cn.exrick.xboot.core.common.vo.Result
import cn.exrick.xboot.supervisionDepartment.controller.ISupervisionDepartmentController
import org.springframework.web.bind.annotation.RestController
import javax.annotation.Resource

@RestController
open class AreaController: ISupervisionDepartmentController.IArea {

    @Resource
    private lateinit var iAreaService: IAreaService


    override fun getByParentId(pid: String): Result<MutableList<Area?>>? {

        return iAreaService.getByPid(pid)
    }

    override fun add(area: Area): Result<Any>? {

        return iAreaService.insertArea(area)
    }

    override fun edit(area: Area): Result<Any>? {

        return iAreaService.updateArea(area)
    }

    override fun delByIds(vararg ids: String): Result<Any> {

        return iAreaService.deleteArea(ids)
    }

    override fun getAreaById(id: String): Result<Area>? {

        return iAreaService.getAreaById(id)
    }

    override fun getAreaByAreaLevel(): Result<MutableList<Area?>>? {

        return iAreaService.getAreaByAreaLevel()
    }
}